package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Daily;
import cn.wolfcode.trip.base.query.DailyQueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface DailyMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Daily record);

    Daily selectByPrimaryKey(Long id);

    List<Daily> selectAll();

    int updateByPrimaryKey(Daily record);

    List<Daily> selectForList(DailyQueryObject qo);

    //查询用户收藏该条日报的次数
    int selectCountByDailyId(Long id);

    //通过userId,dailyId查询用户是否收藏该条日报
    int selectCountByDailyIdAndUserId(@Param("userId") Long userId, @Param("dailyId") Long dailyId);

    //收藏日报
    void saveCollection(@Param("userId") Long userId, @Param("dailyId") Long dailyId, @Param("date") Date date);

    //取消收藏
    void deleteCollection(@Param("userId") Long userId, @Param("dailyId") Long dailyId);

    //查询日报id,用于回显
    List<Daily> selectCollectionByUserId(Long userId);

    //通过用户名查询用户收藏的日报
    List selectCollectionDailyByUserId(DailyQueryObject qo);
}